package online.cmagic.structureType.proxy.dynamicproxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

/**
 * 动态代理模式
 * @author wsc
 * @date: 2020年04月14日 13:12
 * @since JDK 1.8
 */
public class TestClient {

    public static void main(String[] args) {
        Star star = new RealStar();
        InvocationHandler invocationHandler = new StarInvocationHandle(star);
        Star st = (Star) Proxy.newProxyInstance(TestClient.class.getClassLoader(),new Class[]{Star.class},invocationHandler);
        st.sing();
    }
}
